﻿using Application.KafkaService;

namespace Test;

public class UnitTest1
{
    [Fact]
    public async Task Test1()
    {
        var producer = new KafkaProducerService();

        // for (int i = 0; i < 10; i++)
        // {
        //     await producer.PublishAsync<object>("test-topic", new { Name = "Test", Age = 6 });
        // }

        await producer.Publish2();
    }

    [Fact]
    public void TestAggregateBy()
    {
        var sales = new[]
        {
            new { Category = "A", Amount = 100 },
            new { Category = "B", Amount = 200 },
            new { Category = "A", Amount = 50 },
            new { Category = "B", Amount = 50 }
        };

        var result = sales.AggregateBy(s => s.Category, 0, (total, sale) => total + sale.Amount);

        var count = sales.CountBy(s => s.Category);


    }
}